<template>
  <div>
    <m-header :title="iNowTitle"></m-header>
    <section id="infoApp" class="message_con con">
      <ul class="message_ul">
        <li class="message_li_card message_card_fir">
          <div class="message_box1">
            认证类型：
          </div>
          <div class="message_box2 clearfix">
            <img src="../common/images/certification.png" alt="" class="img_certification">
            <P>
              <span class="" :class="dataInfo.user_type == '1'?'':'dis_none'">个人开发者</span>
              <span :class="dataInfo.user_type == '2'?'':'dis_none'">企业开发者</span>
              <span :class="dataInfo.user_type == '3'?'':'dis_none'">系统管理员</span>
              <span class="card_audit"
                    :class="dataInfo.oauth_status == '2' && dataInfo.userExtra.sesameCreditFlag == '1'?'':'dis_none'">待认证</span>
              <span class="card_audit"
                    :class="dataInfo.oauth_status == '2' && dataInfo.userExtra.sesameCreditFlag != '1'?'':'dis_none'">待审核</span>
              <span class="card_audit" :class="dataInfo.oauth_status == '3'?'':'dis_none'">证件已认证</span>
              <span class="card_audit" :class="dataInfo.oauth_status == '4'?'':'dis_none'">认证不通过</span>
            </P>
          </div>
        </li>
        <li class="message_li_card clearfix">
          <div class="message_box1">
            真实姓名：
          </div>
          <div class="message_box2">
            <p v-html="dataInfo.realname"></p>
          </div>
        </li>
        <li class="message_li_card clearfix">
          <div class="message_box1">
            证件类型：
          </div>
          <div class="message_box2">
            <p v-if="dataInfo.id_type == '1' || dataInfo.userExtra.sesameCreditFlag == '1'">身份证</p>
            <p v-else>护照</p>
          </div>
        </li>
        <li class="message_li_card clearfix">
          <div class="message_box1">
            证件号码：
          </div>
          <div class="message_box2">
            <p v-html="dataInfo.id_nbr"></p>
          </div>
        </li>
        <li class="message_li_card clearfix" v-if="dataInfo.userExtra.sesameCreditFlag != 1">
          <div class="message_box1">
            证件照片：
          </div>
          <div class="message_box2">
            <img :src="dataInfo.remotePath" alt="" class="card_img">
          </div>
        </li>
      </ul>
      <router-link to="/accountSelect" class="btn_big bind_big_btn" tag="a" style="display: none;"
                   v-show="dataInfo.oauth_status == '4' || dataInfo.oauth_status == '2'">重新认证
      </router-link>
      <!--<a href="/mconsole/personal_attst.html" class="btn_big bind_big_btn" style="display: none;" v-show="dataInfo.oauth_status == '4' || dataInfo.oauth_status == '2'" ></a>-->
    </section>
    <Copyright></Copyright>
  </div>
</template>

<script type="text/ecmascript-6">
  import MHeader from 'base/m-header/m-header'
  import {ERR_OK, IMGHOST} from 'config/config'
  import Copyright from 'base/copyright/copyright'

  export default {
    data() {
      return {
        iNowTitle: '账号认证',
        dataInfo: {
          realname: '',
          id_type: null,
          id_nbr: '',
          id_desc: '',
          remotePath: '',
          oauth_status: '',
          user_type: '',
          userExtra: {
            sesameCreditFlag: null
          }
        }
      }
    },
    created() {
      this.getInfo()
    },
    methods: {
      getInfo() {
        this.$http({
          method: 'post',
          url: '/mobile/api/v1.0/user/oAuthPersonalInfo'
        }).then((res) => {
          if (res.data.code == ERR_OK) {
            Object.assign(this.dataInfo, res.data.data)
            this.dataInfo.remotePath = IMGHOST + res.data.data.remotePath;
          }
        }).catch((err) => {
          console.log(err)
        })
      }
    },
    components: {
      MHeader,
      Copyright
    }
  }
</script>

<style lang="less" rel="stylesheet/less" scoped>
  .dis_none {
    display: none;
  }
</style>
